package com.icinfo.cloud.provider.punish.ucase.app.controller;

import cn.hutool.core.util.ObjectUtil;
import com.icinfo.cloud.provider.punish.ucase.caseregister.dto.RegisterSaveDto;
import com.icinfo.cloud.provider.punish.ucase.caseregister.service.ICaseRegisterService;
import com.icinfo.cloud.provider.punish.ucase.caseregister.vo.CaseRegisterSaveVo;
import com.icinfo.framework.common.web.Result;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 立案相关接口
 *
 * @author yunchao.peng
 * @create 2023-11-20 9:27
 */
@RestController()
@RequestMapping("/register")
public class AppRegisterController {

    @Resource
    private ICaseRegisterService caseRegisterService;


    /**
     * 立案登记
     */
    @PostMapping(value = "/saveCaseRegister")
    public Result<CaseRegisterSaveVo> saveCaseRegister(@RequestBody @Validated RegisterSaveDto saveDto) {
        CaseRegisterSaveVo caseRegisterSaveVo = caseRegisterService.saveCaseRegisterApp(saveDto);
        if (ObjectUtil.isNotEmpty(caseRegisterSaveVo)) {
            return Result.success(caseRegisterSaveVo);
        }
        return Result.error("立案失败！");
    }
}
